package com.itdaan.portal.business.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.itdaan.portal.business.domain.Web;
import com.itdaan.portal.business.mapper.WebMapper;
import com.itdaan.portal.business.service.WebService;
import com.itdaan.portal.common.exception.ServiceException;
/**
 * @author www.itdaan.com
 */
@Service(value = "webService")
public class WebServiceImpl implements WebService {

	@Resource(name = "webMapper")
	private WebMapper webMapper;

	/**
	 * 分页查询
	 */
	@Override
	public List<Web> findWebs(Web web) throws ServiceException {
		return webMapper.selectWebs(web);
	}

	/**
	 * 查询总数
	 */
	@Override
	public Integer findWebCount(Web web) throws ServiceException {
		return webMapper.selectWebsCount(web);
	}

	/**
	 * 查询单条记录
	 */
	@Override
	public Web findWebOne(Web web) throws ServiceException {
		return webMapper.selectOne(web);
	}

	/**
	 * 修改单条记录
	 */
	@Override
	public int updateWeb(Web web) throws ServiceException {
		return webMapper.updateByPrimaryKeySelective(web);
	}

	/**
	 * 新增单条记录
	 */
	@Override
	public int addWeb(Web web) throws ServiceException {
		return webMapper.insertSelective(web);
	}

	/**
	 * 批量删除记录
	 */
	@Override
	public int delWebs(String ids) throws ServiceException {
		String [] idss = ids.split(",");
		for(String id : idss){
			webMapper.deleteByPrimaryKey(Integer.parseInt(id));
		}
		return 1;
	}
	
}
